// pages/shop-details/shop-details.js
var app=getApp();
var WxParse = require('../../wxParse/wxParse.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    imgUrls: [
      'https://p3.pstatp.com/large/43700001e49d85d3ab52',
      'https://p3.pstatp.com/large/39f600038907bf3b9c96',
      'https://p3.pstatp.com/large/39f600038907bf3b9c96',
      'https://p3.pstatp.com/large/31fa0003ed7228adf421'
    ],
    swiperCurrent: 0,
    indicatorDots: true,
    autoplay: true,
    interval: 3000,
    duration: 800,
    circular: true,
    mall_id:"",//商品id
    goods:[],
  },
  swiperChange:function(){

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options.mall_id)
    this.setData({
      mall_id: options.mall_id,
    });
    this.goodsDetails();
  },
  //商品详情
  goodsDetails: function () {
    var that = this;
    wx.request({
      url: app.globalData.baseUrl +"/a/mall/Info/index",
      data: {
        user_id:8,
        id: that.data.mall_id,
      },
      header: {
        // 'content-type': 'application',
        'TOKEN': "dxgANYXU4RqrAXo6OVwmBc9oodHWNXG2",
      },
      method: 'GET',
      success(res) {
        console.log("详情", res);
        var content = res.data.result.info.content;
        //获取到的数据 单条
        content = content.substring(169, ); //要截取字段的字符串
        WxParse.wxParse('article', 'html', content, that, 0);
       that.setData({
         goods: res.data.result.info,
       });
      }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})